import { defineConfig , DefaultTheme } from 'vitepress'
import {componentPreview, containerPreview} from "@vitepress-demo-preview/plugin";
/**
 * @description 顶部nav配置
 * @author 莫若省
 * @createTime 2024/8/20
*/
const nav: DefaultTheme.NavItem[]   = [
    { text: '入门指南', link: '/guide/' },
    {text: '组件', link: '/components/'}
]
/**
 * @description 对应侧边菜单栏
 * @author 莫若省
 * @createTime 2024/8/20
*/
const sidebar: DefaultTheme.Sidebar = {
    '/guide/': [
        {
            text:'入门指南',
            items:[
                { text: '快速开始', link: '/guide/' },
                { text: '注意事项', link: '/guide/quickstart' },
            ],
            collapsed:true
        }
        ],
    '/components/': [
        {
            text: '组件库',
            items: [
                {text: 'Button 按钮', link: '/components/button'},
                {text: 'Input 输入框', link: '/components/input'},
                {text: 'Table 表格', link: '/components/table'},
                {text: 'Form 表单', link: '/components/form'},
                {text: 'Select 选择器', link: '/components/select'},
                {text: 'Pagination 分页', link: '/components/pagination'},
                {text: 'Dialog 对话框', link: '/components/dialog'},
                {text: 'Message 全局提示', link: '/components/message'},
                {text: 'Loading 加载中', link: '/components/loading'},
                {text: 'Upload 上传', link: '/components/upload'},
            ],
            collapsed: true
        },
        {
            text: '工具集',
            items: [
                {text: 'Button 按钮', link: '/components/button'},
                {text: 'Input 输入框', link: '/components/input'},
                {text: 'Table 表格', link: '/components/table'},
                {text: 'Form 表单', link: '/components/form'},
                {text: 'Select 选择器', link: '/components/select'},
                {text: 'Pagination 分页', link: '/components/pagination'},
                {text: 'Dialog 对话框', link: '/components/dialog'},
                {text: 'Message 全局提示', link: '/components/message'},
                {text: 'Loading 加载中', link: '/components/loading'},
                {text: 'Upload 上传', link: '/components/upload'},
            ],
            collapsed: true
        },
        ]
}
// @ts-ignore
/**
 * @description 默认配置
 * @author 莫若省
 * @createTime 2024/8/20
 */
export default defineConfig({
    //渲染页面头部的配置
    head: [
        ['link', { rel: 'icon', href: '/github.svg' }],
    ],
    //文档标题
    title: '若省的WEB组件库',
    description: 'Web开发从零到一',
    lang: 'zh-CN',
    base: '/',
    lastUpdated: true,
    //主题配置
    themeConfig: {
        //搜索工具
        search: {
            provider: 'local',
            options: {
                locales: {
                    root: {
                        translations: {
                            button: {
                                buttonText: '请输入文档标题',
                                buttonAriaLabel: '搜索文档',
                            },
                            modal: {
                                noResultsText: '无法找到相关结果',
                                resetButtonTitle: '清除查询条件',
                                footer: {
                                    selectText: '选择',
                                    navigateText: '切换'
                                }
                            }
                        }
                    }
                }
            }
        },
        //主题logo
        logo: '/github.svg',
        //显示标题等级
        outline: {
            label: '目录',
            level: 2,
        },
        //顶部右侧icon外链
        socialLinks: [
            { icon:{
                svg:'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1724137622780" class="icon" viewBox="0 0 1316 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="29158" xmlns:xlink="http://www.w3.org/1999/xlink" width="257.03125" height="200"><path d="M643.181714 247.698286l154.916572-123.172572L643.181714 0.256 643.072 0l-154.660571 124.269714 154.660571 123.245715 0.109714 0.182857z m0 388.461714h0.109715l399.579428-315.245714-108.361143-87.04-291.218285 229.888h-0.146286l-0.109714 0.146285L351.817143 234.093714l-108.251429 87.04 399.433143 315.136 0.146286-0.146285z m-0.146285 215.552l0.146285-0.146286 534.893715-422.034285 108.397714 87.04-243.309714 192L643.145143 1024 10.422857 525.056 0 516.754286l108.251429-86.893715L643.035429 851.748571z" fill="#1E80FF" p-id="29159"></path></svg>'
                }, link: 'https://juejin.cn/user/1922421253212766' }
        ],
        //顶部nav配置
        nav,
        //侧边菜单栏配置
        sidebar,
        //底部信息配置
        footer:{
            message: '欢迎来到学习乐园，专注Web开发技术干货分享！',
            copyright: '© 2024 莫若省 All rights reserved'
        },
        //上一页下一页提示内容
        docFooter: {
            prev: '上一页',
            next: '下一页'
        }
    },
    //markdown配置
    markdown: {
        theme: {
            light: 'vitesse-light',
            dark: 'vitesse-dark'
        },
        lineNumbers: true,
        config(md) {
            md.use(componentPreview)
            md.use(containerPreview)
        }
    },
})
